package com.jerkin.cycle;

/**
 * @version V1.0
 * @ClassName: TestCycleDependency
 * @Description:测试spring循环依赖的解决方案
 * @author: huhongzhi
 * @date: 2020/6/13 23:37
 */
public class TestCycleDependency {
    //测试spring循环依赖的原理，先通过常见引用对象
    //后续在set属性解决,此方案无法解决有参构造的依赖循环
    //原型bean代表多个引用,无法查找也没法解决循环依赖问题
    public static void main(String[] args) {
        School school = new School();
        Student student = new Student();
        school.setStudent(student);
        student.setSchool(school);
        student.setName("测试学生");
        school.setName("测试学校");
        System.out.println("学校:"+school.toString());
        System.out.println("学生:"+student.toString());

    }
}
